int IndexOf( T item )

robot_2Generated
code_blocksInput

Description

The IndexOf method in the NetList<T> class is used to determine the index of a specific item within the list. It returns the zero-based index of the first occurrence of the specified item, or -1 if the item is not found.

Usage

To use the IndexOf method, call it on an instance of NetList<T> and pass the item you want to locate as a parameter. The method will return the index of the item if it exists in the list, or -1 if it does not.

Example

// Example usage of NetList<T>.IndexOf
public class MyComponent : Component
{
    [Sync] public NetList<int> MyIntegerList { get; set; } = new();

    public int FindIndexOfNumber(int number)
    {
        return MyIntegerList.IndexOf(number);
    }
}